package com.itheima.Controller;

import com.itheima.DTO.MemberDTO;
import com.itheima.Service.MemberService;
import com.itheima.common.entity.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@Api(tags ="手机号快速登陆")
@RequestMapping("/member")
public class MemberController {

    @Autowired
    private MemberService MemberService;


    @PostMapping("/login")
    @ApiOperation("手机号快速登陆")
    public Result login(@RequestBody MemberDTO memberDTO){
        log.info("手机号快速登陆");
        Result success =  new Result(true,"验证码输入正确");
        Result fail = new Result(false,"验证码输入错误");
        Boolean flag = MemberService.login(memberDTO);

        if (flag){
            return success;
        }else {
            return fail;
        }


    }
}
